package com.ctgu.computer.service.impl;

import com.ctgu.computer.domain.dto.PageQueryDTO;
import com.ctgu.computer.domain.result.PageResult;
import com.ctgu.computer.domain.vo.DocumentVO;
import com.ctgu.computer.domain.vo.NoticeVO;
import com.ctgu.computer.mapper.DocumentMapper;
import com.ctgu.computer.service.DocumentService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class DocumentServiceImpl implements DocumentService {

    private final DocumentMapper documentMapper;
    @Override
    public PageResult page(PageQueryDTO pageQueryDTO) {
        PageHelper.startPage(pageQueryDTO.getPageIndex(),pageQueryDTO.getPageSize());
        Page<DocumentVO> res = documentMapper.page(pageQueryDTO);
        System.out.println("查询到的文件"+res.getResult());
        return new PageResult(res.getTotal(),res.getResult());
    }
}
